<template>
  <div class="search-bar">
    <el-form :inline="true" :model="formItem" class="form-filter" size="mini">
      <el-form-item>
        <el-select v-model="formItem.s_category" clearable placeholder="请选择类型">
          <el-option v-for="(item) in typeList" :key="item.code" :label="item.name" :value="item.name" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button plain icon="el-icon-search" @click="search" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { list } from '@neu/dcam-ui/api/businessProcess'
// 定义一个查询表单原始项
const formItem = {
  s_category: ''
}

export default {
  name: 'TodoTaskTableFilter',
  data() {
    return {
      // 表单集合
      typeList: [],
      formItem: {
        ...formItem
      }
    }
  },
  created() {
    list({}).then(res => {
      this.typeList = res.data
    })
  },
  methods: {
    // 查询按钮点击事件处理
    search: function() {
      this.$parent.filter(this.formItem)
    }
  }
}
</script>
